package executable.basic;

import ctu.kfad.run.util.FileUtil;
import ctu.kfad.run.util.StringUtil;

public class NativeCall {

    public static native int nativeFnc();

    public static int callNative() {
        return nativeFnc();
    }

    public static String callNativeString() {
        return StringUtil.concatenate("aaa", "bbbb");
    }

    public static String callNativeStringAdv() {
        final String concatenate = StringUtil.concatenate("aaa", "bbbb");
        return StringUtil.concatenate(concatenate, "ccccc");
    }

    public static void callNativePrint() {
        StringUtil.print("wwwwwwwwwwwwww");
    }


    public static String readText() {
        return FileUtil.readToString("files/file.txt");
    }

    public static boolean writeAndRead() {
        String content = "asdasdasd;kdfskmdsfmlkdfslk";
        final String path = "files/files/file2.txt";
        FileUtil.writeTo(path, content);
        String content2 = FileUtil.readToString(path);
        if (content.equals(content2)) {
            return true;
        }
        return false;

    }

}
